Attribute VB_Name = "COC7函数"

'骰子
Function Dice(Max As Integer, Optional Min As Integer = 1)
    Randomize
    Dice = WorksheetFunction.RandBetween(Min, Max)
End Function

'函数
Function 困难(iNum As Integer)
    困难 = Int(iNum / 2)
End Function

Function 极难(iNum As Integer)
    极难 = Int(iNum / 5)
End Function

'ParamArray
Function 求平均(ParamArray arr())
    求平均 = Int(WorksheetFunction.Average(arr))
End Function

Function 成功率(iNum As Integer)
    Dim iNormal%, iHard%, iVeryHard%
    iNormal = iNum
    iHard = Int(iNum / 2)
    iVeryHard = Int(iNum / 5)
    成功率 = iNormal & "/" & iHard & "/" & iVeryHard
End Function

Function 技能普通(天生 As Integer, 成长 As Integer, 职业 As Integer, 兴趣 As Integer)
    '保底
    If 天生 < 0 Then 天生 = 0
    If 成长 < 0 Then 成长 = 0
    If 职业 < 0 Then 职业 = 0
    If 兴趣 < 0 Then 兴趣 = 0
    
    技能普通 = 天生 + 成长 + 职业 + 兴趣
    
End Function

